package com.mililoan.common.bean;

public final class JqgridResultSetFactory {
    
    @SuppressWarnings("unchecked")
    public static <T> JqgridResultSet<T> toJqgridResultSet(PageResultSet<T> prs){
        JqgridResultSet<T> jqgridResultSet=new JqgridResultSet<T>();
        //page当前页  total总页数  records总记录数
        jqgridResultSet.setRows(prs.getResult());
        jqgridResultSet.setRecords(prs.getRecordNum());
        jqgridResultSet.setPage(prs.getCurPage());
        jqgridResultSet.setTotal((int)Math.ceil((double)prs.getRecordNum()/(double)prs.getPageSize()));
        return jqgridResultSet;
    }
}
